﻿'
' Will Strohl (wills@strohlsitedesign.com)
' http://www.willstrohl.com
'
'Copyright (c) 2009, Will Strohl
'All rights reserved.
'
'Redistribution and use in source and binary forms, with or without modification, are 
'permitted provided that the following conditions are met:
'
'Redistributions of source code must retain the above copyright notice, this list of 
'conditions and the following disclaimer.
'
'Redistributions in binary form must reproduce the above copyright notice, this list 
'of conditions and the following disclaimer in the documentation and/or other 
'materials provided with the distribution.
'
'Neither the name of StrohlSiteDesign.com nor the names of its contributors may be 
'used to endorse or promote products derived from this software without specific prior 
'written permission.
'
'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
'EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
'OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
'SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
'INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
'TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
'BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
'CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
'ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
'DAMAGE.
'

Imports System
Imports DotNetNuke

Namespace WillStrohl.Modules.FeedHandler

    Public MustInherit Class DataProvider

#Region " Private Members "

        Private Const c_Object As String = "data"
        Private Const c_ObjectType As String = "WillStrohl.Modules.FeedHandler"

#End Region

#Region " Shared/Static Methods "

        ' singleton reference to the instantiated object 
        Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject(c_Object, c_ObjectType, c_ObjectType), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance() As DataProvider
            Return objProvider
        End Function

#End Region

#Region " Abstract Methods "

        Public MustOverride Function GetModuleIds(ByVal ModuleId As Integer) As IDataReader

        ' feeds
        Public MustOverride Function GetFeed(ByVal FeedId As Integer) As IDataReader
        Public MustOverride Function GetFeeds(ByVal ModuleId As Integer) As IDataReader
        Public MustOverride Function AddFeed(ByVal ModuleId As Integer, ByVal FeedName As String, ByVal FeedModuleId As Integer, ByVal FeedImportURL As String, ByVal FeedUrl As String) As Integer
        Public MustOverride Sub UpdateFeed(ByVal FeedId As Integer, ByVal ModuleId As Integer, ByVal FeedName As String, ByVal FeedModuleId As Integer, ByVal FeedImportURL As String, ByVal FeedUrl As String)
        Public MustOverride Sub DeleteFeed(ByVal FeedId As Integer)

        ' feed rules
        Public MustOverride Function GetFeedRule(ByVal RuleId As Integer) As IDataReader
        Public MustOverride Function GetFeedRules(ByVal FeedId As Integer) As IDataReader
        Public MustOverride Function AddFeedRule(ByVal FeedId As Integer, ByVal RuleName As String, ByVal LookFor As String, ByVal ReplaceWith As String) As Integer
        Public MustOverride Sub UpdateFeedRule(ByVal RuleId As Integer, ByVal FeedId As Integer, ByVal RuleName As String, ByVal LookFor As String, ByVal ReplaceWith As String)
        Public MustOverride Sub DeleteFeedRule(ByVal RuleId As Integer)

#End Region

    End Class

End Namespace